<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <title>Page Title</title>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <link rel='stylesheet' type='text/css' media='screen' href='main.css'>
    <script src='main.js'></script>
</head>
<body>
    
</body>
<script>
// 1. 创建并描述小狗对象
const dog = {
    name: "大黄",
    color: "黄色",
    age: 3,
    weight: 250,
    hobby: "吃大骨头",
    walkSpeed: "慢",
    
    describe() {
        return `有一个${this.color}的小狗，叫${this.name}，今年已经${this.age}岁了，${this.weight}斤的重量每次走路都${this.walkSpeed}，喜欢${this.hobby}。`;
    }
};

console.log(dog.describe());    
</script>
<script>
    // 2. 创建并遍历手机对象
const phone = {
    model: "iPhone 14",
    color: "星光色",
    call(phoneNumber) {
        return `正在拨打 ${phoneNumber}...`;
    },
    sendMessage(phoneNumber, message) {
        return `向 ${phoneNumber} 发送消息：${message}`;
    }
};

// 遍历对象属性
console.log("手机属性：");
for (const key in phone) {
    if (typeof phone[key] !== 'function') {
        console.log(`${key}: ${phone[key]}`);
    }
}

// 测试方法
console.log(phone.call("10086"));
console.log(phone.sendMessage("10086", "查询余额"));    
</script>
</html>